package com.example.DemoDataeaseExample.entity;

public abstract class DatasourceConfiguration {
    // 数据源类型枚举
    public enum DatasourceType {
        kingbase("kingbase", "Kingbase", "OLTP", "\"", "\"");
        
        private String feature;
        private String desc;
        private String category;
        private String keywordPrefix;
        private String keywordSuffix;
        
        DatasourceType(String feature, String desc, String category, String keywordPrefix, String keywordSuffix) {
            this.feature = feature;
            this.desc = desc;
            this.category = category;
            this.keywordPrefix = keywordPrefix;
            this.keywordSuffix = keywordSuffix;
        }
        
        public String getFeature() {
            return feature;
        }
        
        public String getDesc() {
            return desc;
        }
        
        public String getCategory() {
            return category;
        }
        
        public String getKeywordPrefix() {
            return keywordPrefix;
        }
        
        public String getKeywordSuffix() {
            return keywordSuffix;
        }
    }
    
    private String host = "localhost";
    private Integer port = 54321;
    private String dataBase = "test";
    private String username;
    private String password;
    private Integer queryTimeout = 30;
    
    // SSH相关配置
    private boolean useSSH = false;
    private String sshHost;
    private Integer sshPort = 22;
    private String sshUsername;
    private String sshPassword;
    private String sshKey;
    private String sshKeyPassword;
    private String sshType = "password";
    private Integer lPort;
    
    // 连接池配置
    private Integer initialPoolSize = 5;
    private Integer minPoolSize = 5;
    private Integer maxPoolSize = 20;
    
    // 抽象方法，由具体实现类提供
    public abstract String getDriver();
    public abstract void setDriver(String driver);
    
    // 构建JDBC URL
    public String getJdbc() {
        return "jdbc:kingbase8://" + host + ":" + port + "/" + dataBase;
    }
    
    // Getter和Setter方法
    public String getHost() {
        return host;
    }
    
    public void setHost(String host) {
        this.host = host;
    }
    
    public Integer getPort() {
        return port;
    }
    
    public void setPort(Integer port) {
        this.port = port;
    }
    
    public String getDataBase() {
        return dataBase;
    }
    
    public void setDataBase(String dataBase) {
        this.dataBase = dataBase;
    }
    
    public String getUsername() {
        return username;
    }
    
    public void setUsername(String username) {
        this.username = username;
    }
    
    public String getPassword() {
        return password;
    }
    
    public void setPassword(String password) {
        this.password = password;
    }
    
    public Integer getQueryTimeout() {
        return queryTimeout;
    }
    
    public void setQueryTimeout(Integer queryTimeout) {
        this.queryTimeout = queryTimeout;
    }
    
    // SSH相关getter/setter
    public boolean isUseSSH() {
        return useSSH;
    }
    
    public void setUseSSH(boolean useSSH) {
        this.useSSH = useSSH;
    }
    
    // 连接池相关getter/setter
    public Integer getInitialPoolSize() {
        return initialPoolSize;
    }
    
    public void setInitialPoolSize(Integer initialPoolSize) {
        this.initialPoolSize = initialPoolSize;
    }
    
    public Integer getMinPoolSize() {
        return minPoolSize;
    }
    
    public void setMinPoolSize(Integer minPoolSize) {
        this.minPoolSize = minPoolSize;
    }
    
    public Integer getMaxPoolSize() {
        return maxPoolSize;
    }
    
    public void setMaxPoolSize(Integer maxPoolSize) {
        this.maxPoolSize = maxPoolSize;
    }
    
    // 其他SSH getter/setter...
}